\hypertarget{pam__quiz_8c}{
\section{/Users/hitokiri/Documents/Code/pam\_\-quiz/pam\_\-quiz.c File Reference}
\label{pam__quiz_8c}\index{/Users/hitokiri/Documents/Code/pam\_\-quiz/pam\_\-quiz.c@{/Users/hitokiri/Documents/Code/pam\_\-quiz/pam\_\-quiz.c}}
}
{\tt \#include \char`\"{}Security.h\char`\"{}}\par
{\tt \#include $<$security/pam\_\-modules.h$>$}\par


Include dependency graph for pam\_\-quiz.c:\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{pam__quiz_8c_0ebda8822b7fdfa5452de792b426603e}{PAM\_\-SM\_\-ACCOUNT}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{pam__quiz_8c_6c835388b158a992b7ae44041e542d91}{setMessage} (int type, const char $\ast$, pam\_\-message $\ast$)
\item 
int \hyperlink{pam__quiz_8c_b31fd37bc48e0612e53d306811083aad}{converse} (pam\_\-handle\_\-t $\ast$pamh, int args, struct pam\_\-message $\ast$$\ast$message, struct pam\_\-response $\ast$$\ast$repsonse)
\item 
PAM\_\-EXTERN int \hyperlink{pam__quiz_8c_4fc07a18e4e61cc5b4d6ded1555d54c1}{pam\_\-sm\_\-acct\_\-mgmt} (pam\_\-handle\_\-t $\ast$pamh, int flags, int argc, const char $\ast$$\ast$argvc)
\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{pam__quiz_8c_0ebda8822b7fdfa5452de792b426603e}{
\index{pam\_\-quiz.c@{pam\_\-quiz.c}!PAM\_\-SM\_\-ACCOUNT@{PAM\_\-SM\_\-ACCOUNT}}
\index{PAM\_\-SM\_\-ACCOUNT@{PAM\_\-SM\_\-ACCOUNT}!pam_quiz.c@{pam\_\-quiz.c}}
\subsubsection[{PAM\_\-SM\_\-ACCOUNT}]{\setlength{\rightskip}{0pt plus 5cm}\#define PAM\_\-SM\_\-ACCOUNT}}
\label{pam__quiz_8c_0ebda8822b7fdfa5452de792b426603e}


pam\_\-quiz.cpp LoginSecurity

Created by Ryan Latta on 2008-12-03. Copyright 2008 Ryan Latta. All rights reserved. 

\subsection{Function Documentation}
\hypertarget{pam__quiz_8c_b31fd37bc48e0612e53d306811083aad}{
\index{pam\_\-quiz.c@{pam\_\-quiz.c}!converse@{converse}}
\index{converse@{converse}!pam_quiz.c@{pam\_\-quiz.c}}
\subsubsection[{converse}]{\setlength{\rightskip}{0pt plus 5cm}int converse (pam\_\-handle\_\-t $\ast$ {\em pamh}, \/  int {\em args}, \/  struct pam\_\-message $\ast$$\ast$ {\em message}, \/  struct pam\_\-response $\ast$$\ast$ {\em response})}}
\label{pam__quiz_8c_b31fd37bc48e0612e53d306811083aad}


This was all taken from pam\_\-stress. Essentially this is a function to handle the details of using pam\_\-conv. It will check for successes and errors and return them back as well. 

setMessage simply does the job of setting up the message structure. Just here for convenience. \hypertarget{pam__quiz_8c_4fc07a18e4e61cc5b4d6ded1555d54c1}{
\index{pam\_\-quiz.c@{pam\_\-quiz.c}!pam\_\-sm\_\-acct\_\-mgmt@{pam\_\-sm\_\-acct\_\-mgmt}}
\index{pam\_\-sm\_\-acct\_\-mgmt@{pam\_\-sm\_\-acct\_\-mgmt}!pam_quiz.c@{pam\_\-quiz.c}}
\subsubsection[{pam\_\-sm\_\-acct\_\-mgmt}]{\setlength{\rightskip}{0pt plus 5cm}PAM\_\-EXTERN int pam\_\-sm\_\-acct\_\-mgmt (pam\_\-handle\_\-t $\ast$ {\em pamh}, \/  int {\em flags}, \/  int {\em argc}, \/  const char $\ast$$\ast$ {\em argvc})}}
\label{pam__quiz_8c_4fc07a18e4e61cc5b4d6ded1555d54c1}


pam\_\-sm\_\-acct\_\-mgmt is the method PAM will use to do account authorization. The purpose of this method is to simply ask questions to the user randomly and assess if they are human or not. What this boils down to is if they can get x out of y questions correct, they will be authorized. 

Order of Events: -1) Get a conversation function pointer to the application (Hopefully). -2) Generate question based on random numbers and flags (Future). -3) Build the conversation functions' message structure and response structure. -Note: Send only one message at a time. (Compatability) -4) Initiate the conversation. -5) Check the response structure for the correct answer. -6) Repeat if necessary (Future). -7) Free the response strucutre -8) Return our success or failure. \hypertarget{pam__quiz_8c_6c835388b158a992b7ae44041e542d91}{
\index{pam\_\-quiz.c@{pam\_\-quiz.c}!setMessage@{setMessage}}
\index{setMessage@{setMessage}!pam_quiz.c@{pam\_\-quiz.c}}
\subsubsection[{setMessage}]{\setlength{\rightskip}{0pt plus 5cm}void setMessage (int {\em type}, \/  const char $\ast$ {\em msg}, \/  pam\_\-message $\ast$ {\em message})}}
\label{pam__quiz_8c_6c835388b158a992b7ae44041e542d91}


